package com.library.utils
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.geom.Point;
	
	public class Transformer
	{
		public function Transformer()
		{
		}
		
		public static function rotate(obj:Sprite, refPoint:Point, angleDegrees:Number):void{
			var origWrap:Sprite = obj.parent as Sprite;
			
			// 方法1 (用矩阵)
//			var m:Matrix = obj.transform.matrix; 
//		    m.tx -= refPoint.x; 
//		    m.ty -= refPoint.y; 
//		    m.rotate (angleDegrees*(Math.PI/180)); 
//		    m.tx += refPoint.x; 
//		    m.ty += refPoint.y; 
//		    obj.transform.matrix = m;

			// 方法2 (包一层)
			var wrap:Sprite = new Sprite();
			wrap.addChild(obj);
			wrap.rotation += angleDegrees;
			trace(angleDegrees);
			//origWrap.addChild(obj);
		}
	}
}